package standaloneGenerator;

import java.util.ArrayList;


import pluginGenerator.PluginVelocityInitializer;

import ctxSemanticsGen.CtxSemanticsGenerator;
import ctxSemanticsGen.XmlProjectAnalyzer;
import ctxSemanticsGen.appDependent.ClassFetcher;
import ctxSemanticsGen.appDependent.VelocityInitializer;

public class StandaloneStarter {
	
	String file = "../TestCOPMethSynt/COPdescriptor.xml";
	String target = "../TestCOPMethSynt/src/machinery";
	
	private void run() throws ClassNotFoundException{
		
		// Get the layered classes and the layers in the project
		XmlProjectAnalyzer xpa = new XmlProjectAnalyzer(file);
		ArrayList<String> classesToProcess = xpa.getLayeredClasses();
		ArrayList<String> layersInSystem = xpa.getLayers();
	
		// Generate COP code in the specified location 
		CtxSemanticsGenerator csg; // TODO: system dependent ?
		ClassFetcher cf = new StandaloneClassFetcher();
		VelocityInitializer rl = new StandaloneVelocityInitializer();
		csg = new CtxSemanticsGenerator(target,classesToProcess,
				                        layersInSystem,cf,rl);
		csg.run();
	}

	
	/**
	 * Entry point for the code generation
	 * 
	 * @param args
	 * @throws ClassNotFoundException 
	 */
	public static void main(String[] args) throws ClassNotFoundException {
		new StandaloneStarter().run();

	}
}
